﻿using BLL;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Model;

namespace WebApi.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    public class YHJController : ControllerBase
    {
        public YHJController(YHJ_BLL bll)
        {
            Bll = bll;
        }

        public YHJ_BLL Bll { get; }


        /// <summary>
        /// 优惠劵添加
        /// </summary>
        /// <param name="m"></param>
        /// <returns></returns>
        [HttpPost("YHJAdd")]
        public IActionResult YHJAdd(YHJ_Model m)
        {
            var m1=Bll.YHJAdd(m);
            return Ok(new 
            {
                data=m1
            });
        }
        /// <summary>
        /// 优惠劵列表
        /// </summary>
        /// <returns></returns>
        [HttpGet("YHJShow")]
        public IActionResult YHJShow()
        {
            var m=Bll.YHJShow();
            return Ok(new
            {
                data = m
            });

        }
    }
}
